#include <iostream>
#include <vector>
#include <cstring>

using namespace std;

const int N = 1e5 + 10;

vector<int> edges[N];
int n, k, st[N], f[N], tmp;

void dfs(int u)
{
	st[u] = true;
	for (auto v : edges[u])
	{
		
		if (!st[v])
		{
			dfs(v);
			f[u] += f[v];
		}
		
	}
}

void dfs2(int u, int mid)
{
	st[u] = true;
	if (f[u] >= mid) tmp++;
	for (auto v : edges[u])
	{
		if (!st[v])
		{
			dfs2(v, mid);
		}
	}
}

int check(int mid)
{
	tmp = 0;
	memset(st, 0, sizeof st);
	dfs2(1, mid);
//	cout << tmp << endl;
	return tmp;
}

int main()
{
	cin >> n >> k;
	for (int i = 1; i < n; i++)
	{
		int x, y; cin >> x >> y;
		edges[x].push_back(y);
		edges[y].push_back(x);
	}
	for (int i = 1; i <= n; i++) f[i] = 1;
	dfs(1);
	for (int i = 1; i <= n; i++) cout << f[i] << " ";
	int l = 1, r = n;
	while(l < r)
	{
		int mid = (l + r  + 1) >> 1;
		if(check(mid) >= k) l = mid;
		else r = mid - 1;
	}
	cout << l << endl;
	return 0;
}
